<?php
/**
 * Jishupu-Laravel-Vue-Admin
 * @Author:技术铺<jishupu@qq.com>
 * @Date: 2021/11/11
 */

namespace App\Http\Resources;

/**
 * 权限模块资源
 * Class PermissionResource
 * @package App\Http\Resources
 */
class PermissionResource extends BaseResource
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return $this->filterFields([
            'id' => $this->id,
            'type' => $this->type,
            'public_type' => $this->public_type,
            'parent_id' => $this->parent_id,
            'name' => $this->name,
            'priv' => $this->priv,
            'uri' => $this->uri,
            'request_methods' => $this->request_methods,
            'controller' => $this->controller,
            'controller_method' => $this->controller_method,
            'description' => $this->description,
            'sort' => $this->sort,
            'created_at' => $this->created_at ? $this->created_at->format('Y-m-d H:i:s') : "",
            'updated_at' => $this->updated_at ? $this->updated_at->format('Y-m-d H:i:s') : "",
        ]);
    }
}
